<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
<head>
    <link rel="stylesheet" th:href="@{/adminlte/layui/css/layui.css}"  media="all"/>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="demoTableOverGoodsOutStock">
    <div class="layui-inline" style="margin-left:0px">销售单号：</div>
    <div class="layui-inline" style="width: 220px">
        <input class="layui-input"  id="productNumSearchOverGoodsOutStock" autocomplete="off" style="width: 200px;height: 25px" placeholder="请输入销售单号"/>
    </div>
    出厂编号：
    <div class="layui-inline" style="width: 220px">
        <input class="layui-input"  id="outStockNumbersSearchOverGoodsOutStock" autocomplete="off" style="width: 200px;height: 25px" placeholder="请输入出厂编号"/>
    </div>
    产品名称：
    <div class="layui-inline" style="width: 220px">
        <!--<input class="layui-input"  id="goodsNameSearch" autocomplete="off" style="width: 200px;height: 25px" placeholder="请输入产品名称"/>-->
        <select id="goodsNameSearchOverGoodsOutStock" style="width: 200px;height: 25px">
            <option value="">请选择产品名称</option>
            <option th:each="goodsNameP1:${goodsNameP}" th:value="${goodsNameP1.dataname}" th:text="${goodsNameP1.dataname}"></option>
        </select>
    </div>
    产品规格:
    <div class="layui-inline" style="width: 220px">
        <!--<input class="layui-input"  id="goodsSpecificationsSearch" autocomplete="off" style="width: 200px;height: 25px" placeholder="请输入产品规格"/>-->
        <select id="goodsSpecificationsSearchOverGoodsOutStock" style="width: 200px;height: 25px">
            <option value="">请选择产品规格</option>
            <option th:each="specificationsP1:${specificationsP}" th:value="${specificationsP1.dataname}" th:text="${specificationsP1.dataname}"></option>
        </select>
    </div>
    <button class="layui-btn layui-btn-sm" data-type="reload">查询</button><br/>
    <div class="layui-inline" style="margin-left: -15px">操作员名称：</div>
    <div class="layui-inline" style="width: 220px;">
        <input class="layui-input"  id="operatorSearchOverGoodsOutStock" autocomplete="off" style="width: 200px;height: 25px" placeholder="请输入操作员名称"/>
    </div>
    起始日期：
    <div class="layui-inline" style="width: 220px">
        <input class="layui-input"  id="startDateSearchOverGoodsOutStock" autocomplete="off" style="width: 200px;height: 25px" placeholder="请选择起始日期"/>
    </div>
    截止日期：
    <div class="layui-inline" style="width: 220px">
        <input class="layui-input"  id="endDateSearchOverGoodsOutStock" autocomplete="off" style="width: 200px;height: 25px" placeholder="请选择截止日期"/>
    </div>

</div>
<div id="add-main-civil" style="display: none;">
    <div class="my-form">
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 170px"><p style="color: red;display: inline">※</p>出库类别</label>
                <!--<div class="layui-input-inline">
                    <input type="text" id="outStockType" name="outStockType" autocomplete="off" class="layui-input" >
                </div>-->
                <select id="outStockTypeB" name="outStockTypeB" style="width: 190px;height: 25px;margin-top: 8px" >
                    <option value="" ></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item my-form-item" style="margin-top: 10px">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 170px"><p style="color: red;display: inline">※</p>销售单号</label>
                <div class="layui-input-inline">
                    <input type="text" id="saleNumAddB" name="saleNumAddB"  autocomplete="off" class="layui-input" placeholder="请输入销售单号">
                </div>
            </div>
        </div>
        <div class="layui-form-item my-form-item" style="margin-top: 10px">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 170px"><p style="color: red;display: inline">※</p>生产单号</label>
                <div class="layui-input-inline">
                    <input type="text" id="productNumAddB" name="productNumAddB"  autocomplete="off" class="layui-input" placeholder="请输入生产单号">
                </div>
            </div>
        </div>
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"  style="width: 170px"><p style="color: red;display: inline">※</p>出库数量</label>
                <div class="layui-input-inline">
                    <input type="text" id="outStockNums"  autocomplete="off" class="layui-input" placeholder="请输入出库数量" onkeyup="value=value.replace(/[^\d]/g,'')">
                </div>
            </div>
        </div>
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"  style="width: 170px"><p style="color: red;display: inline">※</p>出厂编号</label>
                <div class="layui-input-inline">
                    <input type="text" id="outStockNumbersB"  autocomplete="off" class="layui-input" placeholder="请输入出厂编号">
                </div>
            </div>
        </div>
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"  style="width: 170px"><p style="color: red;display: inline">※</p>物流信息</label>
                <div class="layui-input-inline">
                    <input type="text" id="logisticsInformationA"  autocomplete="off" class="layui-input" placeholder="请输入物流信息">
                </div>
            </div>
        </div>
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 170px">备注</label>
                <div class="layui-input-inline">
                    <input type="text" id="remarksAdd" name="remarks" autocomplete="off" class="layui-input" placeholder="请输入备注">
                </div>
            </div>
        </div>
    </div>
</div>
<div id="checkRen" style="display: none;">
    <div class="my-form">
        <div class="layui-form-item my-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 170px;margin-top: 25px">检测人</label>
                <div class="layui-input-inline" style="margin-top: 25px">
                    <input type="text" id="checkPerson" name="checkPerson" autocomplete="off" class="layui-input" placeholder="请输入出厂检测人">
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbarDemoOverOut">
<div class="layui-btn-container">
    <button class="layui-btn layui-btn-sm" lay-event="addOverOut"  >出库</button>
    <button class="layui-btn layui-btn-sm" lay-event="checkOverOut" id="checkOverOut" >检测</button>
    <button class="layui-btn layui-btn-sm" lay-event="outStockOverOut" id="outStockOverOut" >发货</button>
    <button class="layui-btn layui-btn-sm" lay-event="outStockRefresh" id="outStockRefresh" >刷新</button>
  <!--  <button class="layui-btn layui-btn-sm" lay-event="deleteOverOut" id="deleteOverOut" >删除</button>-->
    <!--<button class="layui-btn layui-btn-sm" lay-event="update" id="update" >修改</button>-->
  <!--  <button class="layui-btn layui-btn-sm" lay-event="upload" id="upload" >导入</button>-->
</div>
</script>
<table class="layui-table" lay-data="{totalRow:true,url:'/overGoods/queryOverGoodsOutStock', page:true, id:'OverOut',toolbar:'#toolbarDemoOverOut',defaultToolbar:['filter', 'print','exports'] }" lay-filter="demoOverOut">
    <thead>
    <tr>
        <th lay-data="{type:'checkbox', fixed: 'left'}" rowspan="2"></th>
        <th lay-data="{align:'center'}" colspan="12">出库信息</th>
        <th lay-data="{align:'center'}" colspan="9">订单信息</th>
        <th lay-data="{align:'center'}" colspan="3">生产信息</th>
        <th lay-data="{align:'center'}" colspan="6">阀门信息</th>
        <th lay-data="{align:'center'}" colspan="5">控制主板信息</th>
        <th lay-data="{align:'center'}" colspan="12">通讯主板信息</th>
        <th lay-data="{align:'center'}" colspan="6">485主板信息</th>

    <tr>
        <!--<th lay-data="{field:'productNum', width:250}" >生产订单号</th>-->
       <th lay-data="{field:'outStockNumbers', width:150}" >出厂编号</th>
        <th lay-data="{field:'confValveModel', width:150}" >配置类型</th>
        <th lay-data="{field:'code', width:150}" >执行状态</th>
       <th lay-data="{field:'recordStatus', width:250}" >记录状态</th>
        <th lay-data="{field:'outStockType',width:150,totalRowText:'合计：'}">出库类别</th>
        <th lay-data="{field:'outStockNums',width:150,totalRow:true}">出库数量</th>
        <th lay-data="{field:'outStockremarks',width:150}" >备注信息</th>
        <th lay-data="{field:'outStockTestPeople', width:150}">出厂检测人</th>
        <th lay-data="{field:'outStockTestTime', width:180}">出厂检测时间</th>
        <th lay-data="{field:'sendGoodsPeople', width:150}">发货人</th>
        <th lay-data="{field:'sendGoodsTime', width:180}">发货时间</th>
        <th lay-data="{field:'logisticsInformation', width:180}">物流信息</th>
        <th lay-data="{field:'saleNum', width:150}" >销售单号</th>
        <th lay-data="{field:'customerName', width:150}" >客户名称</th>
        <th lay-data="{field:'date', width:150}" >订单日期</th>
        <th lay-data="{field:'projectName', width:150}" >工程名称</th>
        <th lay-data="{field:'endDate', width:150}" >需求日期</th>
        <th lay-data="{field:'productNameOrder', width:150}" >产品名称</th>
        <th lay-data="{field:'productSpecificationsOrder',width:150}" >规格</th>
        <th lay-data="{field:'customerPressure',width:150}" >使用压力</th>
        <th lay-data="{field:'customerNums',width:150}" >数量</th>
        <th lay-data="{field:'productNum', width:150}">生产单号</th>
       <!-- <th lay-data="{field:'assembler', width:150}">装配人</th>
        <th lay-data="{field:'productDate', width:180}">装配时间</th>
        <th lay-data="{field:'tester', width:150}">检测人</th>
        <th lay-data="{field:'testDate', width:180}">检测时间</th>-->
        <th lay-data="{field:'outFactoryMan', width:150}">成品出库人</th>
        <th lay-data="{field:'getOutFactoryTime', width:180}">成品出库时间</th>
        <th lay-data="{field:'valveSupplier', width:150 }">阀门供应商</th>
        <th lay-data="{field:'valveNUms', width:180 }">阀门编号</th>
        <th lay-data="{field:'valveName', width:150}">阀门名称</th>
        <th lay-data="{field:'valveSpecifications', width:150}">阀门规格</th>
        <th lay-data="{field:'intakeDirection', width:150}">进气方向</th>
        <th lay-data="{field:'vavleProductDate', width:150}">生产日期</th>
        <th lay-data="{field:'controlMainboardSupplier', width:150}">控制主板供应商</th>
        <th lay-data="{field:'controlMainBoardNums', width:180}">控制主板编号</th>
        <th lay-data="{field:'controlMainboardName', width:150 }">控制主板名称</th>
        <th lay-data="{field:'controlMainboardSpecifications', width:150}">控制主板规格</th>
        <th lay-data="{field:'controlMainBoardProductDate', width:150}">生产日期</th>
        <!--<th lay-data="{field:'version', width:150}">程序版本</th>-->
        <th lay-data="{field:'telMainBoardSupplier', width:150}">通信主板供应商</th>
        <th lay-data="{field:'telMainBoardNums', width:180}">通信主板编号</th>
        <th lay-data="{field:'telMainBoardName', width:150}">通信主板名称</th>
        <th lay-data="{field:'telMainBoardSpecifications', width:150}">通信主板规格</th>
        <th lay-data="{field:'telType', width:150}">通信方式</th>
        <th lay-data="{field:'cardNum', width:150}">卡号</th>
        <th lay-data="{field:'iMSI', width:150}">IMSI号</th>
        <th lay-data="{field:'iMEI', width:150}">IMEI号</th>
        <th lay-data="{field:'iCCID', width:150}">ICCID号</th>
        <th lay-data="{field:'activeTime', width:150}">激活日期</th>
        <th lay-data="{field:'shutdownTime', width:150}">截止日期</th>
        <th lay-data="{field:'telMainBoardProductDate', width:150}">生产日期</th>
        <th lay-data="{field:'fourSupplier', width:150}">485供应商</th>
        <th lay-data="{field:'fourMainBoardNums', width:150}">485主板编号</th>
        <th lay-data="{field:'fourMainBoardName', width:150}">485主板名称</th>
        <th lay-data="{field:'fourSpecifications', width:150}">485主板规格</th>
        <th lay-data="{field:'telProtocol', width:150}">通信协议</th>
        <th lay-data="{field:'fourMainBoardProductDate', width:150}">生产日期</th>
    </tr>
    </thead>
</table>

<script th:src="@{/adminlte/layui/layui.all.js}" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use('table', function(){
        var table = layui.table;
        //监听表格复选框选择
        table.on('checkbox(demoOverOut)', function(obj){
            console.log(obj)
        });
        //监听头工具栏事件
        table.on('toolbar(demoOverOut)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id)
                ,data = checkStatus.data//获取选中的数据
                ,deList=[1];
            data.forEach(function (n,i) {
                deList.push(n.id)
            });
            deList.push(2);
            switch(obj.event){
                case 'addOverOut':
                    layer.open({
                        type:1,
                        title:'出库',
                        btnAlign: 'c',
                        area: ['450px', '420px'],
                        btn:['保存','取消'],
                        content: $("#add-main-civil"),
                        yes:function(index,layero){
                            var saleNumAdd =top.$("#saleNumAddB").val();
                            var productNumAdd =top.$("#productNumAddB").val();
                            var outStockNumbers =top.$("#outStockNumbersB").val();
                            var outStockType =top.$("#outStockTypeB").val();
                            var remarksAdd =top.$("#remarksAdd").val();
                            var outStockNums =top.$("#outStockNums").val();
                            var logisticsInformation =top.$("#logisticsInformationA").val();
                            if(saleNumAdd==""||productNumAdd==""||outStockNumbers==""||outStockType==""||outStockNums==""){
                                  /*  alert("您还有必填项未填哦！")*/
                                layer.msg('您还有必填项未填哦！', {
                                    btnAlign: 'c',
                                    time: 3000, //20s后自动关闭
                                    btn: ['确定']
                                });
                            }else {
                                $.ajax({
                                    //几个参数需要注意一下
                                    type: "POST",//方法类型
                                    dataType: "json",//预期服务器返回的数据类型
                                    url: "/overGoods/addOverGoodsOutStock" ,//url
                                    data: {outStockNums:outStockNums,productNum:productNumAdd,salenum:saleNumAdd,outStockType:outStockType,outStockremarks:remarksAdd,outStockNumbers:outStockNumbers,logisticsInformation:logisticsInformation},
                                    success: function (result) {
                                        console.log(result);//打印服务端返回的数据(调试用)
                                        if (result.success >0) {
                                            layer.msg('操作成功', {
                                                btnAlign: 'c',
                                                time: 3000, //20s后自动关闭
                                                btn: ['确定']
                                            });
                                            table.reload('OverOut');
                                        }else{
                                           /* alert("出库失败，请核对库存");*/
                                            layer.msg('出库失败，请核对库存', {
                                                btnAlign: 'c',
                                                time: 3000, //20s后自动关闭
                                                btn: ['确定']
                                            });
                                        }
                                    },
                                    error : function() {
                                        alert("异常！");
                                    }
                                });

                                layer.close(index);
                            }

                        },
                        btn2:function (index) {
                            layer.close(index);
                        },
                    });
                    break;
                case 'checkOverOut':
                    if(data.length === 0){
                        layer.msg('请选择一行');
                    } else if(data.length > 1){
                        layer.msg('只能同时检测一个');
                    }else if (checkStatus.data[0].recordStatus=="已发货"){
                       /* alert("货物已经发出去了！")*/
                        layer.msg('货物已经发出去了！');
                    } else if (checkStatus.data[0].productNameOrder.indexOf("民用")>-1){

                        layer.msg('请去民用生产进行测试！');
                    } else if (checkStatus.data[0].recordStatus=="检测中"||checkStatus.data[0].recordStatus=="")  {
                        var id =checkStatus.data[0].id;
                        var productNum =checkStatus.data[0].productNum;
                        layer.confirm('确定检测？',{btn: ['确定', '取消'], title: "提示"},function(index){
                            layer.open({
                                type:1,
                                title:'检测',
                                btnAlign: 'c',
                                area: ['400px', '200px'],
                                btn:['保存','取消'],
                                content: $("#checkRen"),
                                yes:function(index,layero){
                                    var checkPerson =top.$("#checkPerson").val();
                                    if(checkPerson==""){
                                        /*  alert("您还有必填项未填哦！")*/
                                        layer.msg('您还有必填项未填哦！', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                    }else {
                                        $.ajax({
                                            //几个参数需要注意一下
                                            type: "POST",//方法类型
                                            dataType: "json",//预期服务器返回的数据类型
                                            url: "/production/overGoodsCheck" ,//url
                                            data: {id:id,productNum:productNum,checkPerson:checkPerson},
                                            success: function (result) {
                                                if (result.success>0&&result.cc>0) {
                                                    layer.msg('操作成功', {
                                                        btnAlign: 'c',
                                                        time: 3000, //20s后自动关闭
                                                        btn: ['确定']
                                                    });
                                                    table.reload('OverOut')
                                                }else if(result.cc==0){
                                                    layer.msg('未找到通讯编号信息', {
                                                        btnAlign: 'c',
                                                        time: 3000, //20s后自动关闭
                                                        btn: ['确定']
                                                    });
                                                }else{
                                                    layer.msg('操作失败', {
                                                        btnAlign: 'c',
                                                        time: 3000, //20s后自动关闭
                                                        btn: ['确定']
                                                    });
                                                }
                                            },
                                            error : function() {
                                                alert("异常！");
                                            }
                                        });
                                        layer.close(index);
                                    }

                                },btn2:function (index) {
                                    layer.close(index);
                                },
                            })
                        });
                    }
                    break;
                case 'outStockOverOut':
                    if(data.length === 0){
                        layer.msg('请选择一行');
                    }else if(data.length > 1){
                        layer.msg('只能同时发货一个');
                    }else if (checkStatus.data[0].recordStatus=="已发货"){
                       /* alert("货物已经发出去了！")*/
                        layer.msg('货物已经发出去了');
                    } else if (checkStatus.data[0].recordStatus=="检测中") {
                        var id1 =checkStatus.data[0].id;
                        var productNum1=checkStatus.data[0].productNum;
                        var customerName=checkStatus.data[0].customerName;
                        var goodName= checkStatus.data[0].productNameOrder;
                        layer.confirm('确定发货？',{btn: ['确定', '取消'], title: "提示"},function(index){
                            $.ajax({
                                //几个参数需要注意一下
                                type: "POST",//方法类型
                                dataType: "json",//预期服务器返回的数据类型
                                url: "/production/overGoodsOutStock2" ,//url
                                data: {id:id1,productNum:productNum1,customerName:customerName,goodName:goodName},
                                success: function (result) {
                                    if (result.success>0&&result.cc>0) {
                                        layer.msg('操作成功', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                        table.reload('OverOut')
                                    }else if(result.cc==0){
                                        layer.msg('未找到通讯编号信息', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                        table.reload('OverOut')
                                    }else{
                                        layer.msg('操作失败', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                    }
                                },
                                error : function() {
                                    alert("异常！");
                                }
                            });
                            layer.close(index);
                        });
                    }
                    break;
                case 'outStockRefresh':
                    table.reload('OverOut');
                    break;
                case 'deleteOverOut':
                    if(data.length === 0){
                        layer.msg('请选择一行');
                    } else {
                        layer.confirm('确定删除',{btn: ['确定', '取消'], title: "提示"},function(index){
                            $.ajax({
                                //几个参数需要注意一下
                                type: "POST",//方法类型
                                dataType: "json",//预期服务器返回的数据类型
                                url: "/overGoods/deleteOverGoodsOutStock" ,//url
                                data: {deList:JSON.stringify(deList)},
                                success: function (result) {
                                    if (result.success>0) {
                                        layer.msg('操作成功', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                        table.reload('OverOut')
                                    }else{
                                        layer.msg('操作失败', {
                                            btnAlign: 'c',
                                            time: 3000, //20s后自动关闭
                                            btn: ['确定']
                                        });
                                    }
                                },
                                error : function() {
                                    alert("异常！");
                                }
                            });
                            layer.close(index);
                        });
                    }
                    break;

            }
        });
        var $ = layui.$, active = {
            /*     getCheckData: function(){ //获取选中数据
                     var checkStatus = table.checkStatus('idTest')
                         ,data = checkStatus.data;
                     layer.alert(JSON.stringify(data));
                 }
                 ,getCheckLength: function(){ //获取选中数目
                     var checkStatus = table.checkStatus('idTest')
                         ,data = checkStatus.data;
                     layer.msg('选中了：'+ data.length + ' 个');
                 }
                 ,isAll: function(){ //验证是否全选
                     var checkStatus = table.checkStatus('idTest');
                     layer.msg(checkStatus.isAll ? '全选': '未全选')
                 }
                 ,*/
            reload:function () {
                var productNum = $("#productNumSearchOverGoodsOutStock").val();
                var outStockNumbers = $("#outStockNumbersSearchOverGoodsOutStock").val();
                var goodsName = $("#goodsNameSearchOverGoodsOutStock").val();
                var specifications = $("#goodsSpecificationsSearchOverGoodsOutStock").val();
                var operator = $("#operatorSearchOverGoodsOutStock").val();
                var startDate = $("#startDateSearchOverGoodsOutStock").val();
                var endDate = $("#endDateSearchOverGoodsOutStock").val();
              /*  console.log(productNum+goodsName+specifications+operator+startDate+endDate);*/
                table.reload('OverOut',{
                    url:'/overGoods/searchOverGoodsOutStock',
                    where:{outStockNumbers:outStockNumbers,salenum:productNum,productNameOrder:goodsName,productSpecificationsOrder:specifications,outFactoryMan:operator,startDate:startDate,endDate:endDate}  ,
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                })

            }
        };

        $('.demoTableOverGoodsOutStock .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#startDateSearchOverGoodsOutStock' //指定元素
            ,type: 'datetime'
        });
        laydate.render({
            elem: '#endDateSearchOverGoodsOutStock' //指定元素
            ,type: 'datetime'
        });
    });
    layui.use(['upload'],function(){
        var $ = layui.jquery,
            upload = layui.upload;
//指定允许上传的文件类型
        upload.render({
            elem: '#upload'
            ,url: '/overGoods/uploadOutStock'
            ,accept: 'file' //普通文件
            ,exts: 'xlsx' //只允许上传excel文件
            ,done: function(res){
                if(res.code == 0){ //上传成功
                    layer.msg(res.msg);
                    table.reload('OverOut');
                }else{
                    layer.msg('上传失败');
                }
            }
            ,error: function(index, upload){
                layer.msg('上传失败');
            }
        });
    });
    $(
        function(){
            outTyp();
        }
    )
    function outTyp() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/queryLocal" ,//url
            data:{pid:162},
            success: function (result) {
                if (result.success>0) {
                    var list =result.date;
                    $("[name='outStockTypeB']").empty();
                    var op="";
                    var bp="请选择出库类别";
                    $("[name='outStockTypeB']").append("<option value="+op+">"+bp+"</option>");
                    $.each(list,function (i,val) {
                        $("[name='outStockTypeB']").append("<option value="+val+">"+val+"</option>");
                    });
                }else{
                    alert("信息错误");
                }
            }
        });
    }
    var unSelected = "#999";
    var selected = "#333";
    $(function () {
        $("select").css("color", unSelected);
        $("option").css("color", selected);
        $("select").change(function () {
            var selItem = $(this).val();
            if (selItem == $(this).find('option:first').val()) {
                $(this).css("color", unSelected);
            } else {
                $(this).css("color", selected);
            }
        });
    })
</script>

</body>
</html>